package br.com.puc.repositories;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import br.com.caelum.vraptor.ioc.Component;
import br.com.puc.models.Projeto;
import br.com.puc.models.enums.StatusProjeto;

@Component
public class ProjetoRepositoryImpl
    extends Repository<Projeto, Long>
    implements ProjetoRepository {

	ProjetoRepositoryImpl(Session session) {
		super(session);
	}

	@Override
	public List<Projeto> findProjetosEmAndamento() {
		Query query = session.createQuery("from " + clazz.getName() + " where status = :status")
							 .setParameter("status", StatusProjeto.EM_ANDAMENTO);
		
		@SuppressWarnings("unchecked")
		List<Projeto> resultList = query.list();

		return resultList;
	}
}
